/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.swirrel.listener;



import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import org.swirrel.util.MethodCall;
import org.swirrel.util.SwirrelException;

/**
 *
 * @author Gronau
 */
public class SwirrelAdjustmentListener extends AbstractSwirrelListener implements AdjustmentListener {

    private final MethodCall adjustmentValueChangedCall;

    public SwirrelAdjustmentListener(MethodCall adjustmentValueChangedCall) {
        this.adjustmentValueChangedCall = adjustmentValueChangedCall;
        if(! checkSignature(adjustmentValueChangedCall, AdjustmentEvent.class)) {
            throw new SwirrelException("Method must have none or one AdjustmentEvent argument");
        }
    }

    public void adjustmentValueChanged(AdjustmentEvent e)  {
        call(adjustmentValueChangedCall, e);
    }
}